<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Amici</title>
</head>
<body>
<%
   session.setAttribute("id", request.getAttribute("id"));
%>
<div id="menu-wrapper">
		<div id="menu">
			<ul>
   				<li><a href="ProfiloAmmServlet?id=<%= request.getAttribute("id") %>"><%= request.getAttribute("id") %></a></li>
   				<li><a href="RicercaAmm.jsp">Ricerca</a></li>
   				<li><a href="LogoutServlet?username=<%= request.getAttribute("id")%>&user=amministratore">Logout</a></li>
   			</ul>
   		</div>
</div>
<div id="page">
		<div id="page-bgtop">
			<div id="page-bgbtm">
				<div id="content">
					<div class="post">
						<h2 class="title">Lista Amici</h2>
						<div class="entry"> 
							<% 
							    int size = Integer.parseInt(request.getAttribute("size").toString()); 
							
							    if(size == 0) {
							    	
							    	out.println("L'utente non ha amici");
							    	
							    }
							    else {
							    	
							    	for(int i = 0; i < size; i++) {
							    		
							    	   String username = request.getAttribute("el" + i).toString();
							 		   String id = request.getAttribute("id").toString();
							 		   out.println("<a href=\"ProfiloUtenteDaAmmServlet?username=" + username + "&id=" + id + "\">");
							   	       out.println(username);
							   	       out.println("</a>");
							   	       out.println("<br/>");
							    		
							    	}
							    	
							    }
							
							%>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>